import React, { useState } from 'react'
import ReactDOM from 'react-dom'
/* 
  组件的两大数据源
  状态 state 组件自己的数据
  属性 props 别人给的数据


*/

function App(props) {
  console.log(props)
  let [name] = useState("珠峰")
  return <h1>函数式组件{name}</h1>
}
class App2 extends React.Component {
  // constructor() {
  //   super()
  //   this.state = {
  //     
  //   }
  // }
  state = {
    name: "珠峰"
  }
  render() {
    console.log(this.state.name)
    console.log(this.props)
    let { name } = this.state;
    return <h1>类组件{name}</h1>
  }
}

ReactDOM.render(<>
  <App className="box111"></App>
  <App2 className="box222"></App2>
</>, document.querySelector('#root'))